package cn.farm.farm.Mapper.CommonMapper;

import cn.farm.farm.Entity.Common.Message;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.mapping.FetchType;

import java.util.List;

public interface MessagetMapper {
    @Select("select * from message where keyword like CONCAT('%',#{keyword},'%') or title like CONCAT('%',#{keyword},'%')")
    @Results({
            @Result(column = "messageImage",property = "messageImage",
                    many = @Many(select = "cn.farm.farm.Mapper.CommonMapper.MatchMapper.getimageID",fetchType= FetchType.EAGER))
    })
    List<Message> likeSelect(@Param(value = "keyword") String keyword);

    @Select("select * from message where messID = #{messageId}")
    @Results({
            @Result(column = "messageImage",property = "messageImage",
                    many = @Many(select = "cn.farm.farm.Mapper.CommonMapper.MatchMapper.getimageID",fetchType= FetchType.EAGER))
    })
    Message foundHotProtect(Integer messageId);
}
